{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a3f700ee-9e1c-4695-b0f9-1646a38a3536",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "请输入本金： 1\n",
      "请输入年利率： 2\n",
      "请输入年份： 3\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "本金利率和为：1.06\n"
     ]
    }
   ],
   "source": [
    "#profit.py\n",
    "nb = float(input(\"请输入本金：\")) #输入本金并转换为浮点数\n",
    "nr = float(input(\"请输入年利率：\")) #输入年利率并转换为浮点数\n",
    "ny = int(input(\"请输入年份：\")) #输入年份并转换为整数\n",
    "amount = nb * (1+nr/100) ** ny\n",
    "print(str.format(\"本金利率和为：{0:2.2f}\", amount))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a4e615cb-b249-47e8-b9e6-7cedf4214090",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
